# Metview Macro

# read the netCDF files
nc12 = read("fc_12.nc")
nc36 = read("fc_36.nc")

# set the current variables to be t2m
setcurrent(nc12, 't2m')
setcurrent(nc36, 't2m')

diff = nc36 - nc12
print(type(diff))

visualise_v2d = netcdf_visualiser(
    netcdf_plot_type          : "geo_matrix",
    netcdf_latitude_variable  : "latitude",
    netcdf_longitude_variable : "longitude",
    netcdf_value_variable     : "t2m",
    netcdf_data               : diff
    )

pos_shade = mcont(
    legend                         : "on",
    contour                        : "off",
    contour_highlight              : "off",
    contour_level_selection_type   : "level_list",
    contour_level_list             : [0.5,1.5,3,5,10,30],
    contour_label                  : "off",
    contour_shade                  : "on",
    contour_shade_method           : "area_fill",
    contour_shade_max_level_colour : "red",
    contour_shade_min_level_colour : "yellow",
    contour_shade_colour_direction : "clockwise"
    )

neg_shade = mcont(
    legend                         : "on",
    contour                        : "off",
    contour_highlight              : "off",
    contour_level_selection_type   : "level_list",
    contour_level_list             : [-30,-10,-5,-3,-1.5,-0.5],
    contour_label                  : "off",
    contour_shade                  : "on",
    contour_shade_method           : "area_fill",
    contour_shade_max_level_colour : "cyan",
    contour_shade_min_level_colour : "blue",
    contour_shade_colour_direction : "clockwise"
    )



atts = attributes(diff)
title = mtext(text_line_1 : atts.long_name & ' ' & atts.units)

plot(visualise_v2d, pos_shade, neg_shade, title)
